package demo._go;

import java.util.Arrays;

public class SanJiaoXing {
	private Double[] dou = new Double[] {};

	public SanJiaoXing(Double x, Double y, Double z) {
		Double[] newdou = new Double[] { x, y, z };
		Arrays.sort(newdou);
		if (newdou[2] >= newdou[1] + newdou[0]) {
			System.out.println("�������󣬴���ʧ��");
			return;
		}
		this.dou = newdou;
	}

	public SanJiaoXing(int i, int j, int k) {
		this((double) i, (double) j, (double) k);
	}

	public Double[] getDou() {
		return dou;
	}

	public Double zhouChang() {
		return dou[0] + dou[1] + dou[2];
	}

	public Double mianJi() {
		double p = (dou[0] + dou[1] + dou[2]) / 2;
		double s = p * (p - dou[0]) * (p - dou[1]) * (p - dou[2]);
		return Math.sqrt(s);
	}

	public void show() {
		System.out.println("[" + dou[0] + "," + dou[1] + "," + dou[2] + "]");
	}

	public void change(int x, Double a) {
		Double[] newdou = new Double[] { dou[0], dou[1], dou[2] };
		newdou[x] = a;
		Arrays.sort(newdou);
		if (newdou[2] >= newdou[1] + newdou[0]) {
			System.out.println("��ֵʧ�ܣ��������������");
			return;
		}
		dou = newdou;
		System.out.print("��ֵ�ɹ���");
		show();
	}
}
